home *** CD-ROM | disk | FTP | other *** search
/ Czech Logic, Card & Gambling Games / Logické hry.iso / hry / Fish Fillets / script / gods / code.lua next >
Encoding:
Text File  |  2005-07-16  |  25.3 KB  |  639 lines

  1.  
  2. file_include("script/share/prog_border.lua")
  3. file_include("script/"..codename.."/prog_ships.lua")
  4.  
  5. local function xor1(value)
  6.     if odd(value) then
  7.         return value - 1
  8.     else
  9.         return value + 1
  10.     end
  11. end
  12. local function xor2(value)
  13.     if isIn(value, {2, 3, 6}) then
  14.         return value - 2
  15.     else
  16.         return value + 2
  17.     end
  18. end
  19.  
  20. local function shinkShip(ship)
  21.     if objekty.afaze == -1 then
  22.         objekty:setEffect("none")
  23.         objekty.shiftY = 0
  24.         objekty.shiftX = randint(10, 30)
  25.         --TODO: lower speed
  26.         objekty.speedY = 1
  27.         objekty.speedX = randint(-1, 1)
  28.         objekty.afaze = ship
  29.         objekty:updateAnim()
  30.     end
  31. end
  32.  
  33. -- -----------------------------------------------------------------
  34. -- Init
  35. -- -----------------------------------------------------------------
  36. local function prog_init()
  37.     initModels()
  38.     sound_playMusic("music/rybky01.ogg")
  39.     local pokus = getRestartCount()
  40.  
  41.     --NOTE: a final level
  42.     small:setGoal("goal_alive")
  43.     big:setGoal("goal_alive")
  44.     buh2:setGoal("goal_out")
  45.  
  46.     -- -------------------------------------------------------------
  47.     local function prog_init_room()
  48.         local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
  49.  
  50.         room.stavhry = 0
  51.         room.posl = 0
  52.         room.uvod = 0
  53.         room.costim = randint(25, 100)
  54.         room.oholi = 0
  55.         room.opalce = 0
  56.         room.omicich = randint(1200, 4000)
  57.         room.shodit = -1
  58.  
  59.         return function()
  60.             if stdBorderReport() then
  61.                 addm(random(10) + 5, "lod-m-bohove")
  62.             end
  63.             if isReady(small) and isReady(big) and no_dialog() then
  64.                 if room.costim > 0 then
  65.                     room.costim = room.costim - 1
  66.                 end
  67.                 if room.omicich > 0 then
  68.                     room.omicich = room.omicich - 1
  69.                 end
  70.                 if room.uvod == 0 then
  71.                     room.uvod = 1
  72.                     switch(random(3)){
  73.                         [0] = function()
  74.                             addv(randint(10, 20), "lod-v-silenost0")
  75.                         end,
  76.                         [1] = function()
  77.                             addv(randint(10, 20), "lod-v-silenost1")
  78.                         end,
  79.                         [2] = function()
  80.                             addv(randint(10, 20), "lod-v-silenost2")
  81.                         end,
  82.                     }
  83.                     switch(random(3)){
  84.                         [0] = function()
  85.                             addm(random(5), "lod-m-pravda0")
  86.                         end,
  87.                         [1] = function()
  88.                             addm(random(5), "lod-m-pravda1")
  89.                         end,
  90.                         [2] = function()
  91.                             addm(random(5), "lod-m-pravda2")
  92.                         end,
  93.                     }
  94.                 elseif room.costim == 0 then
  95.                     room.costim = -1
  96.                     switch(random(2)){
  97.                         [0] = function()
  98.                             addm(random(5), "lod-m-costim")
  99.                             addv(random(5), "lod-v-internovat")
  100.                             addm(random(5), "lod-m-co")
  101.                             addv(random(5), "lod-v-cvok")
  102.                             addm(random(5), "lod-m-oba")
  103.                             addv(random(5), "lod-v-golf")
  104.                             addm(random(5), "lod-m-jednoho")
  105.                         end,
  106.                         [1] = function()
  107.                             addm(random(5), "lod-m-costim")
  108.                             addv(random(5), "lod-v-internovat")
  109.                             addm(random(5), "lod-m-oba")
  110.                             addv(random(5), "lod-v-golf")
  111.                             addm(random(5), "lod-m-jednoho")
  112.                         end,
  113.                     }
  114.                     addv(random(7), "lod-v-koho")
  115.                     switch(random(2)){
  116.                         [0] = function()
  117.                             planSet(big, "hlaska", 1)
  118.                             addm(random(3), "lod-m-zluty")
  119.                         end,
  120.                         [1] = function()
  121.                             planSet(big, "hlaska", 2)
  122.                             addm(random(3), "lod-m-modry")
  123.                         end,
  124.                     }
  125.                     switch(random(2)){
  126.                         [0] = function()
  127.                             addm(random(5), "lod-m-hrac")
  128.                         end,
  129.                         [1] = function()
  130.                             addv(random(5), "lod-v-hrac")
  131.                         end,
  132.                     }
  133.                 elseif room.oholi == 0 and hul.dir ~= dir_no and big ~= dir_no and random(100) < 1 then
  134.                     room.oholi = 1
  135.                     addv(0, "lod-v-hul")
  136.                     addm(random(7), "lod-m-ozizlana")
  137.                 elseif room.opalce == 0 and random(1000) < 1 then
  138.                     room.opalce = 1
  139.                     addv(random(10), "lod-v-hravost")
  140.                     if palka.X == 23 and palka.Y == 2 then
  141.                         addm(random(7), "lod-m-palka")
  142.                     end
  143.                 elseif room.omicich == 0 then
  144.                     room.omicich = -1
  145.                     if kriketak.X > 24 and kriketak.Y > 19 then
  146.                         addv(random(5), "lod-v-micky")
  147.                         addm(random(5), "lod-m-vyznam")
  148.                         addv(random(5), "lod-v-kdovi")
  149.                     end
  150.                     addm(random(5), "lod-m-micek")
  151.                     addv(random(5), "lod-v-rozliseni")
  152.                 end
  153.             end
  154.             switch(room.stavhry){
  155.                 [0] = function()
  156.                     initLode()
  157.                     buh1.lodi = getNShips()
  158.                     buh2.lodi = getNShips()
  159.                     room.hraje = 1
  160.                     room.stavhry = room.stavhry + 1
  161.                     room.cekani = random(10) + 5
  162.                 end,
  163.                 [1] = function()
  164.                     if no_dialog() then
  165.                         if room.cekani > 0 then
  166.                             room.cekani = room.cekani - 1
  167.                         else
  168.                             switch(room.hraje){
  169.                                 [1] = function()
  170.                                     buh1.cinnost = 1
  171.                                 end,
  172.                                 [2] = function()
  173.                                     buh2.cinnost = 1
  174.                                 end,
  175.                             }
  176.                             room.stavhry = 2
  177.                         end
  178.                     end
  179.                 end,
  180.                 [2] = function()
  181.                     room.stavhry = 1
  182.                     if buh2.lodi == 0 then
  183.                         planDialogSet(3, "b2-vyhral", 201, buh2, "mluveni")
  184.                         room.stavhry = 3
  185.                     end
  186.                     if buh1.lodi == 0 then
  187.                         planDialogSet(8, "b1-vyhral", 101, buh1, "mluveni")
  188.                         room.stavhry = 3
  189.                     end
  190.                     if room.stavhry == 1 then
  191.                         room.cekani = random(10) + 5
  192.                     else
  193.                         room.cekani = random(100) + 100
  194.                         switch(random(2)){
  195.                             [0] = function()
  196.                                 planDialogSet(random(30) + 10, "b2-znovu", 201, buh2, "mluveni")
  197.                                 planDialogSet(random(10) + 5, "b1-dobre", 101, buh1, "mluveni")
  198.                             end,
  199.                             [1] = function()
  200.                                 planDialogSet(random(30) + 10, "b1-znovu", 101, buh1, "mluveni")
  201.                                 planDialogSet(random(10) + 5, "b2-dobre", 201, buh2, "mluveni")
  202.                             end,
  203.                         }
  204.                     end
  205.                 end,
  206.                 [3] = function()
  207.                     if no_dialog() then
  208.                         if room.cekani > 0 then
  209.                             room.cekani = room.cekani - 1
  210.                         else
  211.                             planDialogSet(0, "b1-zacinam", 101, buh1, "mluveni")
  212.                             room.stavhry = 0
  213.                         end
  214.                     end
  215.                 end,
  216.             }
  217.             if room.shodit >= 0 then
  218.                 shinkShip(room.shodit)
  219.                 room.shodit = -1
  220.             end
  221.         end
  222.     end
  223.  
  224.     -- -------------------------------------------------------------
  225.     local function prog_init_buh2()
  226.         local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
  227.  
  228.         buh2.cinnost = 0
  229.         buh2.mluveni = 0
  230.         buh2.cinruky = 0
  231.         buh2.ruka = 0
  232.         buh2.px = 0
  233.         buh2.py = 0
  234.         buh2.lodi = getNShips()
  235.  
  236.         return function()
  237.             switch(buh2.cinnost){
  238.                 [1] = function()
  239.                     pom1, buh2.px, buh2.py = hrajlode(2)
  240.                     buh2.cekat = random(10) + 5
  241.                     local arg = string.char(buh2.py - 1 + string.byte("A"))..buh2.px
  242.                     planDialogSet(buh2.cekat, "b2-"..string.char(buh2.py - 1 + string.byte("a")).."@"..arg, 201, buh2, "mluveni")
  243.                     buh2.cinnost = 2
  244.                     buh2.cekat = buh2.cekat + random(4) + 9
  245.                     switch(pom1){
  246.                         [1] = function()
  247.                             adddel(random(20) + 20)
  248.                             planSet(buh1, "cinruky", random(3) + 1)
  249.                             planDialogSet(0, "b1-voda"..(random(5) + 1), 102, buh1, "mluveni")
  250.                             planSet(buh2, "cinruky", random(3) + 1)
  251.                             room.hraje = 1
  252.                         end,
  253.                         [3] = function()
  254.                             adddel(random(20) + 20)
  255.                             planSet(buh1, "cinruky", random(3) + 3)
  256.                             planDialogSet(0, "b1-zasah"..(random(4) + 1), 103, buh1, "mluveni")
  257.                             planSet(buh2, "cinruky", random(3) + 3)
  258.                         end,
  259.                         [4] = function()
  260.                             adddel(random(20) + 20)
  261.                             planSet(buh1, "cinruky", random(3) + 1)
  262.                             planDialogSet(0, "b1-potop"..(random(3) + 1), 104, buh1, "mluveni")
  263.                             planSet(buh1, "cinruky", -random(10) - 5)
  264.                             planSet(buh2, "cinruky", -random(10) - 5)
  265.                             buh2.lodi = buh2.lodi - 1
  266.                             planSet(room, "shodit", getLastHit())
  267.                         end,
  268.                         [5] = function()
  269.                             planDialogSet(random(20) + 20, "b1-voda"..(random(5) + 1), 102, buh1, "mluveni")
  270.                             adddel(5)
  271.                             planSet(buh2, "mluveni", 3)
  272.                             planDialogSet(10 + random(10), "b2-podvadis", 220, buh2, "mluveni")
  273.                             planDialogSet(8, "b2-"..string.char(buh2.py - 1 + string.byte("a")).."@"..arg, 220, buh2, "mluveni")
  274.                             planDialogSet(0, "b2-"..buh2.px, 220, buh2, "mluveni")
  275.                             planDialogSet(0, "b2-nemuze", 220, buh2, "mluveni")
  276.                             planDialogSet(random(30) + 10, "b1-spletl", 105, buh1, "mluveni")
  277.                             planDialogSet(random(5) + 5, "b1-potop"..(random(3) + 1), 104, buh1, "mluveni")
  278.                             buh2.lodi = buh2.lodi - 1
  279.                             planSet(room, "shodit", getLastHit())
  280.                         end,
  281.                         [6] = function()
  282.                             planDialogSet(random(20) + 20, "b1-zasah"..(random(4) + 1), 103, buh1, "mluveni")
  283.                             planDialogSet(random(10), "b2-podvadis", 220, buh2, "mluveni")
  284.                             planDialogSet(random(10), "b2-spatne", 220, buh2, "mluveni")
  285.                             switch(random(2)){
  286.                                 [0] = function()
  287.                                     planDialogSet(random(30) + 10, "b1-spletl", 105, buh1, "mluveni")
  288.                                 end,
  289.                                 [1] = function()
  290.                                     planDialogSet(random(5) + 2, "b1-nepodvadim", 106, buh1, "mluveni")
  291.                                 end,
  292.                             }
  293.                         end,
  294.                         [7] = function()
  295.                             planDialogSet(random(20) + 20, "b1-potop"..(random(3) + 1), 104, buh1, "mluveni")
  296.                             planDialogSet(random(10), "b2-podvadis", 220, buh2, "mluveni")
  297.                             planDialogSet(random(10), "b2-spatne", 220, buh2, "mluveni")
  298.                             switch(random(2)){
  299.                                 [0] = function()
  300.                                     planDialogSet(random(30) + 10, "b1-spletl", 105, buh1, "mluveni")
  301.                                 end,
  302.                                 [1] = function()
  303.                                     planDialogSet(random(5) + 2, "b1-nepodvadim", 106, buh1, "mluveni")
  304.                                 end,
  305.                             }
  306.                             buh2.lodi = buh2.lodi - 1
  307.                             planSet(room, "shodit", getLastHit())
  308.                         end,
  309.                     }
  310.                 end,
  311.                 [2] = function()
  312.                     if buh2.cekat > 0 then
  313.                         buh2.cekat = buh2.cekat - 1
  314.                     else
  315.                         buh2:talk("b2-"..buh2.px, 201)
  316.                         buh2.cinnost = 0
  317.                     end
  318.                 end,
  319.             }
  320.             switch(buh2.mluveni){
  321.                 [0] = function()
  322.                     if not isIn(buh2.xicht, {3, 4, 6, 7}) or random(100) < 4 then
  323.                         buh2.xicht = random(6) + 3
  324.                         if buh2.xicht == 5 or buh2.xicht == 8 then
  325.                             buh2.xicht = 3
  326.                         end
  327.                     end
  328.                 end,
  329.                 [1] = function()
  330.                     if not isIn(buh2.xicht, {8, 9}) or random(100) < 3 then
  331.                         buh2.xicht = 8 + random(2)
  332.                         buh2.afaze = buh2.xicht + buh2.ruka * 10
  333.                     end
  334.                 end,
  335.                 [2] = function()
  336.                     if not isIn(buh2.xicht, {0, 1}) or random(100) < 5 then
  337.                         buh2.xicht = random(2)
  338.                     end
  339.                 end,
  340.                 [3] = function()
  341.                     if not isIn(buh2.xicht, {1, 2}) or random(100) < 5 then
  342.                         buh2.xicht = random(2) + 1
  343.                     end
  344.                 end,
  345.                 [220] = function()
  346.                     if buh2.xicht == 5 then
  347.                         buh2.xicht = 6
  348.                     else
  349.                         buh2.xicht = 5
  350.                     end
  351.                 end,
  352.                 default = function()
  353.                     if 200 <= buh2.mluveni and buh2.mluveni <= 219 then
  354.                         if odd(game_getCycles()) then
  355.                             buh2.xicht = random(3)
  356.                         end
  357.                     end
  358.                 end,
  359.             }
  360.             if buh2.mluveni == 0 or buh2.mluveni == 1 or (200 <= buh2.mluveni and buh2.mluveni <= 220) then
  361.                 if buh2.ruka > 3 then
  362.                     buh2.ruka = random(4)
  363.                 end
  364.                 if buh2.cinruky == 0 then
  365.                     if random(100) < 2 then
  366.                         buh2.ruka = random(4)
  367.                     end
  368.                 elseif buh2.cinruky > 0 then
  369.                     if math.mod(game_getCycles(), 3) == 0 then
  370.                         if random(100) < 30 then
  371.                             buh2.ruka = xor1(buh2.ruka)
  372.                         else
  373.                             buh2.ruka = xor2(buh2.ruka)
  374.                         end
  375.                         buh2.cinruky = buh2.cinruky - 1
  376.                     end
  377.                 else
  378.                     if random(100) < 30 then
  379.                         buh2.ruka = xor1(buh2.ruka)
  380.                     else
  381.                         buh2.ruka = xor2(buh2.ruka)
  382.                     end
  383.                     buh2.cinruky = buh2.cinruky + 1
  384.                 end
  385.                 buh2.afaze = buh2.ruka * 10 + buh2.xicht
  386.             elseif buh2.mluveni == 2 or buh2.mluveni == 3 then
  387.                 if not isIn(buh2.ruka, {4, 5, 6}) or odd(game_getCycles()) and random(100) < 30 then
  388.                     buh2.ruka = random(3) + 4
  389.                 end
  390.                 if buh2.ruka == 4 then
  391.                     switch(buh2.xicht){
  392.                         [0] = function()
  393.                             buh2.afaze = 0
  394.                         end,
  395.                         [1] = function()
  396.                             buh2.afaze = 6
  397.                         end,
  398.                         [2] = function()
  399.                             buh2.afaze = 9
  400.                         end,
  401.                     }
  402.                 else
  403.                     buh2.afaze = buh2.ruka * 3 + 25 + buh2.xicht
  404.                 end
  405.             end
  406.             buh2:updateAnim()
  407.         end
  408.     end
  409.  
  410.     -- -------------------------------------------------------------
  411.     local function prog_init_buh1()
  412.         local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
  413.  
  414.         buh1.cinnost = 0
  415.         buh1.ruka = 0
  416.         buh1.oci = 0
  417.         buh1.pusa = 0
  418.         buh1.mluveni = 0
  419.         buh1.cinruky = 0
  420.         buh1.px = 0
  421.         buh1.py = 0
  422.         buh1.lodi = getNShips()
  423.  
  424.         return function()
  425.             switch(buh1.cinnost){
  426.                 [1] = function()
  427.                     pom1, buh1.px, buh1.py = hrajlode(1)
  428.                     buh1.cekat = random(10) + 5
  429.                     local arg = string.char(buh1.py - 1 + string.byte("A"))..buh1.px
  430.                     planDialogSet(buh1.cekat, "b1-"..string.char(buh1.py - 1 + string.byte("a")).."@"..arg, 101, buh1, "mluveni")
  431.                     buh1.cinnost = 2
  432.                     buh1.cekat = buh1.cekat + random(4) + 9
  433.                     switch(pom1){
  434.                         [1] = function()
  435.                             adddel(random(20) + 20)
  436.                             planSet(buh2, "cinruky", random(2) + 1)
  437.                             planDialogSet(0, "b2-voda"..(random(5) + 1), 202, buh2, "mluveni")
  438.                             planSet(buh1, "cinruky", random(2) + 1)
  439.                             room.hraje = 2
  440.                         end,
  441.                         [3] = function()
  442.                             adddel(random(20) + 20)
  443.                             planSet(buh2, "cinruky", random(3) + 2)
  444.                             planDialogSet(0, "b2-zasah"..(random(4) + 1), 203, buh2, "mluveni")
  445.                             if random(3) == 0 then
  446.                                 planSet(buh2, "mluveni", 1)
  447.                             end
  448.                             planSet(buh1, "cinruky", random(3) + 2)
  449.                         end,
  450.                         [4] = function()
  451.                             adddel(random(20) + 20)
  452.                             planSet(buh2, "cinruky", random(3) + 1)
  453.                             planDialogSet(0, "b2-potop"..(random(3) + 1), 204, buh2, "mluveni")
  454.                             if random(3) ~= 0 then
  455.                                 planSet(buh2, "mluveni", 1)
  456.                             end
  457.                             planSet(buh1, "cinruky", -random(7) - 5)
  458.                             planSet(buh2, "cinruky", -random(7) - 5)
  459.                             buh1.lodi = buh1.lodi - 1
  460.                             planSet(room, "shodit", getLastHit())
  461.                         end,
  462.                         [8] = function()
  463.                             adddel(10 + random(10))
  464.                             planSet(buh2, "mluveni", 2)
  465.                             planDialogSet(random(15) + 10, "b2-rikal"..(random(2) + 1), 205, buh2, "mluveni")
  466.                             planDialogSet(1, "b2-voda1", 201, buh2, "mluveni")
  467.                             room.hraje = 2
  468.                         end,
  469.                         [9] = function()
  470.                             adddel(10 + random(10))
  471.                             planSet(buh2, "mluveni", 2)
  472.                             planDialogSet(random(15) + 10, "b2-rikal"..(random(2) + 1), 201, buh2, "mluveni")
  473.                         end,
  474.                     }
  475.                 end,
  476.                 [2] = function()
  477.                     if buh1.cekat > 0 then
  478.                         buh1.cekat = buh1.cekat - 1
  479.                     else
  480.                         buh1:talk("b1-"..buh1.px, 101)
  481.                         buh1.cinnost = 0
  482.                     end
  483.                 end,
  484.             }
  485.             if buh1.mluveni > 100 then
  486.                 if odd(game_getCycles()) and buh1.mluveni > 101 or math.mod(game_getCycles(), 4) == 1 then
  487.                     if random(2) == 1 then
  488.                         buh1.pusa = math.mod(buh1.pusa + 1, 3)
  489.                     else
  490.                         buh1.pusa = math.mod(buh1.pusa + 2, 3)
  491.                     end
  492.                 end
  493.             end
  494.             switch(buh1.mluveni){
  495.                 [0] = function()
  496.                     if buh2.mluveni > 0 then
  497.                         buh1.pusa = 0
  498.                     else
  499.                         buh1.pusa = 0
  500.                     end
  501.                     if random(100) < 3 then
  502.                         buh1.oci = random(2)
  503.                     end
  504.                 end,
  505.                 [105] = function()
  506.                     if room.posl ~= buh1.mluveni then
  507.                         buh1.oci = 0
  508.                     end
  509.                     room.posl = buh1.mluveni
  510.                 end,
  511.                 [106] = function()
  512.                     if room.posl ~= buh1.mluveni then
  513.                         buh1.oci = 2
  514.                     end
  515.                     room.posl = buh1.mluveni
  516.                 end,
  517.                 default = function()
  518.                     if isIn(buh1.mluveni, {101, 102}) then
  519.                         if room.posl ~= buh1.mluveni then
  520.                             buh1.oci = math.floor(random(3) / 2)
  521.                         elseif random(100) < 3 then
  522.                             buh1.oci = 1 - buh1.oci
  523.                         end
  524.                         room.posl = buh1.mluveni
  525.                     elseif isIn(buh1.mluveni, {103, 104}) then
  526.                         if room.posl ~= buh1.mluveni then
  527.                             buh1.oci = 2 - math.floor(random(3) / 2)
  528.                         elseif random(100) < 3 then
  529.                             buh1.oci = 3 - buh1.oci
  530.                         end
  531.                         room.posl = buh1.mluveni
  532.                     end
  533.                 end,
  534.             }
  535.             if buh1.cinruky == 0 then
  536.                 if random(100) < 4 then
  537.                     buh1.ruka = random(4)
  538.                 end
  539.             elseif buh1.cinruky > 0 then
  540.                 if math.mod(game_getCycles(), 2) == 0 then
  541.                     pom1 = random(3)
  542.                     if pom1 == buh1.ruka then
  543.                         pom1 = 3
  544.                     end
  545.                     buh1.ruka = pom1
  546.                     buh1.cinruky = buh1.cinruky - 1
  547.                 end
  548.             else
  549.                 pom1 = random(3)
  550.                 if pom1 == buh1.ruka then
  551.                     pom1 = 3
  552.                 end
  553.                 buh1.ruka = pom1
  554.                 buh1.cinruky = buh1.cinruky + 1
  555.             end
  556.             buh1.afaze = buh1.ruka * 12 + buh1.oci * 4 + buh1.pusa
  557.             buh1:updateAnim()
  558.         end
  559.     end
  560.  
  561.     -- -------------------------------------------------------------
  562.     local function prog_init_big()
  563.         local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
  564.  
  565.         big.hlaska = 0
  566.  
  567.         return function()
  568.             switch(big.hlaska){
  569.                 [1] = function()
  570.                     big:talk("lod-v-modry")
  571.                 end,
  572.                 [2] = function()
  573.                     big:talk("lod-v-zluty")
  574.                 end,
  575.             }
  576.             big.hlaska = 0
  577.         end
  578.     end
  579.  
  580.     -- -------------------------------------------------------------
  581.     local function prog_init_objekty()
  582.         local pom1, pom2, pomb1, pomb2 = 0, 0, false, false
  583.  
  584.         objekty.afaze = -1
  585.         objekty:setEffect("invisible")
  586.  
  587.         return function()
  588.             if objekty.afaze >= 0 then
  589.                 model_setViewShift(objekty.index,
  590.                         objekty.shiftX, objekty.shiftY)
  591.                 objekty.shiftY = objekty.shiftY + objekty.speedY
  592.                 objekty.shiftX = objekty.shiftX + objekty.speedX
  593.  
  594.                 if objekty.shiftY >= room:getH() then
  595.                     objekty.afaze = -1
  596.                     objekty:setEffect("invisible")
  597.                 end
  598.             end
  599.         end
  600.     end
  601.  
  602.     -- --------------------
  603.     local update_table = {}
  604.     local subinit
  605.     subinit = prog_init_room()
  606.     if subinit then
  607.         table.insert(update_table, subinit)
  608.     end
  609.     subinit = prog_init_buh2()
  610.     if subinit then
  611.         table.insert(update_table, subinit)
  612.     end
  613.     subinit = prog_init_buh1()
  614.     if subinit then
  615.         table.insert(update_table, subinit)
  616.     end
  617.     subinit = prog_init_big()
  618.     if subinit then
  619.         table.insert(update_table, subinit)
  620.     end
  621.     subinit = prog_init_objekty()
  622.     if subinit then
  623.         table.insert(update_table, subinit)
  624.     end
  625.     return update_table
  626. end
  627. local update_table = prog_init()
  628.  
  629.  
  630. -- -----------------------------------------------------------------
  631. -- Update
  632. -- -----------------------------------------------------------------
  633. function prog_update()
  634.     for key, subupdate in pairs(update_table) do
  635.         subupdate()
  636.     end
  637. end
  638.  
  639.